package com.wjggy.core.service.posts.Impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.wjggy.core.common.dbtools.DaoUtils;
import com.wjggy.core.common.page.Page;
import com.wjggy.core.entities.Forums;
import com.wjggy.core.entities.Posts;
import com.wjggy.core.service.posts.PostsService;


 /**
 *  <p>Description:  </p>
 *  <p>Copyright:Copyright (c) 2012  </p>
 *  <p>Company:wjggy  </p>
 *  @author xiaofan.yu  
 *  @date   2012-2-3 下午06:47:45    
 *  @project  wjggy
 *  @version  1.0.0
 *  @see   
 *  @since 1.6 
 */
@Service("postsService")
public class PostsServiceImpl implements PostsService {
	private static final Logger log = Logger.getLogger(ForumServiceImpl.class);
	@Resource(name="daoUtils")
	private DaoUtils daoUtils;
	@Override
	public List<Posts> findPosts(Posts posts,Page page) {
		return daoUtils.findRows("posts.queryAll", posts,page);
	}
	@Override
	public boolean addPosts(Posts posts) {
		int i=daoUtils.add("posts.insert", posts);
		return i==1?true:false;
	}
	@Override
	public boolean deletePosts(Posts posts) {
		int i=daoUtils.delete("posts.delete", posts);
		return i==1?true:false;
	}
	@Override
	public boolean updatePosts(Posts posts) {
		int i=daoUtils.update("posts.update", posts);
		return i==1?true:false;
	}
	@Override
	public Posts findPost(Posts posts) {
		return (Posts) daoUtils.findObject("posts.queryByID", posts);
	}
	 
}

